package com.ls.ai.advisor;

import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.chat.client.ChatClientRequest;
import org.springframework.ai.chat.client.ChatClientResponse;
import org.springframework.ai.chat.client.advisor.api.AdvisorChain;
import org.springframework.ai.chat.client.advisor.api.BaseAdvisor;
import org.springframework.stereotype.Component;

/**
 * @Author 刘帅
 * @Date: 2025-07-01 15:32
 * @RequestID 需求单号
 * @Version 1.0
 */
@Slf4j
@Component
public class PrintLoggerAdvisor implements BaseAdvisor {
    @Override
    public ChatClientRequest before(ChatClientRequest chatClientRequest, AdvisorChain advisorChain) {
        log.info("Advisor: " + chatClientRequest);
        return chatClientRequest;
    }

    @Override
    public ChatClientResponse after(ChatClientResponse chatClientResponse, AdvisorChain advisorChain) {
        log.info("Advisor: " + chatClientResponse);
        return chatClientResponse;
    }

    @Override
    public int getOrder() {
        return 0;
    }
}
